﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Main : System.Web.UI.MasterPage
{
    private SessionHelper m_SessionHelper = new SessionHelper();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (m_SessionHelper.Member != null)
            {
                ltlMemberName.Text = string.Format("Hi,{0}", m_SessionHelper.Member.Name);
                aLogout.Visible = true;
                aJoin.Visible = false;
                aLogin.Visible = false;
            }
            else
            {
                ltlMemberName.Text = string.Empty;
                aLogout.Visible = false;
                aJoin.Visible = true;
                aLogin.Visible = true;
            }
        }
    }

    protected void btnLogout_Click(object sender, EventArgs e)
    {
        m_SessionHelper.Member = null;
        Response.Redirect("index.aspx");
    }
}
